package com.itshizhan.itjidancideveloper.dao;

import com.itshizhan.itjidancideveloper.models.Word;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface WordDao extends JpaRepository<Word, Long>, JpaSpecificationExecutor<Word> {
	//jpql 不支持 limit，所以使用nativeQuery
	@Query(nativeQuery = true, value = "SELECT * FROM base_word w WHERE w.wordname LIKE CONCAT('%',?1,'%')  LIMIT 10")
	List<Word> findByWordNameLike(String wordName);
}
